Developer Documentation

QuickTime 4 API Documentation

QuickTime Movie File Format Specification, May 1996

| Previous | Chapter contents | Chapter top | Next |

Sample-to-Chunk Atoms

As samples are added to a media, they are collected into chunks that allow optimized data access. A chunk may contain one or more samples. Chunks in a media may have different sizes, and the samples within a chunk may have different sizes. The sample-to-chunk atom stores chunk information for the samples in a media.

Sample-to-chunk atoms have an atom type of 'stsc' . The sample-to-chunk atom contains a table that maps samples to chunks in the media data stream. Figure 0-36 shows the layout of a sample-to-chunk atom. By examining the sample-to-chunk atom, you can determine the chunk that contains a specific sample.

Figure 36 The layout of a sample-to-chunk atom

The sample-to-chunk atom contains the following data elements.

Size
A 32-bit integer that specifies the number of bytes in this sample-to-chunk atom.
Type
A 32-bit integer that identifies the atom type; this field must be set to 'stsc' .
Version
A 1-byte specification of the version of this sample-to-chunk atom.
Flags
A 3-byte space for sample-to-chunk flags. Set this field to 0.
Number of entries
A 32-bit integer containing the number of entries in the sample-to-chunk table.
Sample-to-chunk table
A table that maps samples to chunks. Figure 0-37 shows the structure of a sample-to-chunk table. Each sample-to-chunk atom contains such a table, which identifies the chunk for each sample in a media. Each entry in the table contains a first chunk field, a samples per chunk field, and a sample description ID field. From this information, you can ascertain where samples reside in the media data.

Figure 37 The layout of a sample-to-chunk table

You define a sample-to-chunk table by specifying the following data elements.

First chunk
The first chunk number using this table entry.
Samples per chunk
The number of samples in each chunk.
Sample description ID
The identification number associated with the sample description for the sample. For details on sample description atoms, see "Sample Description Atoms," beginning on [link] .

Figure 0-38 shows an example of a sample-to-chunk table that is based on the data stream shown in Figure 0-28 .

Figure 38 An example of a sample-to-chunk table

Each table entry corresponds to a set of consecutive chunks, each of which contains the same number of samples. Furthermore, each of the samples in these chunks must use the same sample description. Whenever the number of samples per chunk or the sample description changes, you must create a new table entry. If all the chunks have the same number of samples per chunk and use the same sample description, this table has one entry.


© 1997 Apple Computer, Inc.

| Previous | Chapter contents | Chapter top | Next |